package com.xyzq.service.ya.impl;

import java.util.HashMap;
import java.util.List;

import org.appfuse.service.impl.GenericManagerImpl;

import com.xyzq.dao.ya.StaffDAO;
import com.xyzq.model.ya.data.Staff;
import com.xyzq.service.ya.StaffManager;

public class StaffManagerImpl extends GenericManagerImpl<Staff, Long> implements
		StaffManager {

	private StaffDAO staffDao;

	public StaffManagerImpl(StaffDAO staffDao) {
		super(staffDao);
		this.setStaffDao(staffDao);
	}

	public void setStaffDao(StaffDAO staffDao) {
		this.staffDao = staffDao;
	}

	public StaffDAO getStaffDao() {
		return staffDao;
	}

	public Staff findByStaffId(Integer staffId) {
		// TODO Auto-generated method stub
		return this.staffDao.findByStaffId(staffId);
	}

	public HashMap<Integer, Staff> getAllStaffMap() {
		// TODO Auto-generated method stub
		HashMap<Integer, Staff> staffMap = new HashMap<Integer, Staff>();
		List<Staff> list = this.staffDao.getAll();
		for (Staff staff : list) {
			staffMap.put(staff.getStaffId(), staff);
		}
		return staffMap;
	}
}
